<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Mixins 混入选项操作</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>Mixins 混入选项操作</h1>
<hr>
<div id="app">
    {{num}}
    <p><button @click="add">更新</button></p>
</div>
<script type="text/javascript">
    Vue.mixin({
      updated(){
        console.log('我是全局混入的updated')
      }
    })
    var mixins = {
      updated(){
        console.log('数据发生了变化，变化后的值'+this.num)
      }
    }
    var app = new Vue({
      el:'#app',
      data:{
        num:1
      },
      updated(){
        console.log('我是原生的updated')
      },
      methods:{
        add(){
          this.num++;
        }
      },
      mixins:[mixins]
    })
</script>
</body>
</html>